//****************************************************
// Porman Project 
// Filename: CRenderCamera.h
// Date: 2011/01/17
// Author: KengYu Lin
// Modify:
//****************************************************
#ifndef _CRENDERCAMERA_H
#define _CRENDERCAMERA_H
#include <vector>
#include "glm-0.9.0.6/glm/glm.hpp"
#include "CRSDef.h"
#include "CRenderBase.h"
#include "CRenderUnity.h"

namespace Porman
{

namespace RS
{

typedef std::vector<CRenderUnity*> CRenderUnityList;

class CRenderCameraData
{
public:
    CRenderCameraData( void ) : m_mat4x4ViewMatrix(), m_mat4x4ProjMatrix() {}
    CRenderCameraData( const CRenderCameraData& l ) { (*this) = l; }
    CRenderCameraData& operator=( const CRenderCameraData& l )
    {
        m_mat4x4ViewMatrix = l.m_mat4x4ViewMatrix;
        m_mat4x4ProjMatrix = l.m_mat4x4ProjMatrix;
        return (*this);
    }

    glm::mat4x4 m_mat4x4ViewMatrix;
    glm::mat4x4 m_mat4x4ProjMatrix;
    CRenderUnityList m_vectRenderUnities;
};

class CRenderCamera : public CRenderBase
{
public:
    CRenderCamera( const std::string& sName, unsigned int uiHash );
    virtual ~CRenderCamera( void );

    PRS_API void initial( void );
    PRS_API glm::mat4x4& getProjMatrix( void );
    PRS_API glm::mat4x4* getProjMatrixRef( void );
    PRS_API glm::mat4x4& getViewMatrix( void );
    PRS_API glm::mat4x4* getViewMatrixRef( void );

    PRS_API CRenderUnityList& getRenderUnityList( void );
    PRS_API CRenderUnityList* getRenderUnityListRef( void );
        
    virtual void onSwap( void );
    virtual void onRender( void );

protected:
    CDataHandlerT<CRenderCameraData> m_hCameraData;
};

}//End RS

}//End namespace Porman

#endif